////////////No need to edit beyond here//////////////

function createAjaxObj()
{
	var httprequest=false
	if (window.XMLHttpRequest){ // if Mozilla, Safari etc
	httprequest=new XMLHttpRequest()
	if (httprequest.overrideMimeType)
	httprequest.overrideMimeType('text/xml')
	}
	else if (window.ActiveXObject){ // if IE
	try {
	httprequest=new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e){
	try{
	httprequest=new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch (e){}
	}
	}
	return httprequest
}



function autorun_ajax(delaySecs)
{
	this.delay=delaySecs
	this.ajaxobj=createAjaxObj()
	this.getAjaxcontent()
}


autorun_ajax.prototype.getAjaxcontent=function()
{
	alert("Scraping...")
	if (this.ajaxobj)
	{
		var instanceOfTicker=this
		//this.ajaxobj.onreadystatechange=function(){instanceOfTicker.initialize()}
		this.ajaxobj.open('GET', "http://football.joshhughes.com/test/test.php", true)
		this.ajaxobj.send(null)
		setTimeout(function(){instanceOfTicker.getAjaxcontent()}, this.delay)
	}
}


autorun_ajax.prototype.initialize=function()
{
	if (this.ajaxobj.readyState == 4)
	{ //if request of file completed
		if (this.ajaxobj.status==200)
		{ //if request was successful
			var instanceOfTicker=this
			this.goScrape()
		}
	}
}


autorun_ajax.prototype.goScrape=function()
{
	alert("Scraping...");
	var instanceOfTicker=this
	 //update container every second
}